<?php

// delete existing cassandra database
// each step is given time to complete
exec('/etc/init.d/cassandra stop');
sleep(2);
exec('rm /var/lib/cassandra/data/Pepandlove -r');
exec('rm /var/lib/cassandra/commitlog/*');
exec('rm /var/www/cache/*');
sleep(2);
// fails to startup if run in default sh shell
exec('bash /etc/init.d/cassandra start');
sleep(5);

// new cassandra database is created on start
// populate it with seed data, ready for a new simulation
exec('php /usr/local/src/php/pepandlove-daemon/seed/main.php');

// record activity in log file
error_log('Simulation cleared and reset');

?>
